package com.erp.myAdapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.erp.bean.BypassBean;
import com.erp.R;

import java.util.List;

/**
 * Created by Administrator on 2016/11/3 0003.
 * 作者：刘洋
 */
public class SeekAdapter extends BaseAdapter {
    private List<BypassBean> mlist;
    private Context mcontext;
    private LayoutInflater minflater;
    public SeekAdapter(List<BypassBean> list, Context context){
        super();
        this.mlist=list;
        this.mcontext=context;
        this.minflater= LayoutInflater.from(context);
    }
    @Override
    public int getCount() {
        return mlist.size();
    }

    @Override
    public Object getItem(int i) {
        return mlist.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder vh ;
        if(view==null){
            vh=new ViewHolder();
            view=minflater.inflate(R.layout.lv_text_item,null);
            vh.tv= (TextView) view.findViewById(R.id.tv_list_item);
            view.setTag(vh);
        }else{
            vh= (ViewHolder) view.getTag();
        }
        vh.tv.setText(mlist.get(i).name);
        return view;
    }
    class ViewHolder{
        TextView tv;
    }
    public void allnotify(List<BypassBean> listby){
        mlist=listby;
        notifyDataSetChanged();
    }
}
